#ifndef _DIGEST_HPP
#define _DIGEST_HPP 1

#include <stdint.h>
#include <strings.h>
#include <string.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <openssl/evp.h>
#include "../constants.hpp"
#include <boost/shared_ptr.hpp>


namespace BFT
{
	namespace messages
	{

		class Digest
		{
			public:
			
			Digest();
			
			Digest(boost::shared_ptr<char> _bytes, uint32_t _bytes_length);
			
			Digest(boost::shared_ptr<char> _bytes, uint32_t _bytes_length, uint32_t offset /*, uint32_t length*/);

			static boost::shared_ptr<Digest> fromBytes(boost::shared_ptr<char> _bytes, uint32_t _bytes_length);
			
			boost::shared_ptr<char> getBytes();
			
			bool equals(boost::shared_ptr<Digest> _d);
			
			uint32_t getSize();
			
			static uint32_t size();
			
			void setBytes(boost::shared_ptr<char> _bytes);
			
			void printInfo();
			
			
			protected:
						
			/*			
			void computeDigest(boost::shared_ptr<char> _bytes, uint32_t _bytes_length);
			void computeDigest(boost::shared_ptr<char> _bytes, uint32_t _bytes_length, uint32_t offset);
			*/
			
			uint32_t count;
			boost::shared_ptr<char> bytes;
		};

		inline uint32_t Digest::getSize() {return DIGEST_SIZE;}
		inline boost::shared_ptr<char> Digest::getBytes() {return bytes;}

	} //namespace messages
} // namespace BFT

#endif


